$(document).ready(function(){
	var name = $( "#txtDescription" ),
		currencies = $( "#ddlCurrencies" ),
		allFields = $( [] ).add( name ).add( currencies );
	
	$("#add_wallet").click(function(event){
		event.preventDefault();
		$("#addWallet").dialog("open");
		$(".ui-widget-overlay").click(function(){
			$("#addWallet").dialog("close");
		});
	});
	
	$("#add_currency").click(function(event){
		event.preventDefault();
		$("#addCurrency").dialog("open");
		$(".ui-widget-overlay").click(function(){
			$("#addCurrency").dialog("close");
		});
	});
	
	$("#imgChangeBalance").click(function(event){
		event.preventDefault();
		$("#changeBalanceCurrency").dialog("open");
		$(".ui-widget-overlay").click(function(){
			$("#changeBalanceCurrency").dialog("close");
		});
	});
	
	
	
	
	
	
	$("#addWallet" ).dialog({
		autoOpen: false,
		height: 300,
		minHeight: 100,
		width: 'auto',
		modal: true,
		resizable: false,
		close: function() {
		allFields.val( "" ).removeClass( "ui-state-error")
	}
	
	});
	
	$("#addCurrency" ).dialog({
		autoOpen: false,
		height: 240,
		minHeight: 100,
		width: 'auto',
		modal: true,
		resizable: false,
		close: function() {
		currencies.val( "" ).removeClass( "ui-state-error");
	}
	
	});

	$("#changeBalanceCurrency" ).dialog({
		autoOpen: false,
		height: 240,
		minHeight: 100,
		width: 'auto',
		modal: true,
		resizable: false,
		close: function() {
			currencies.val( "" ).removeClass( "ui-state-error");
		}
		
	});
	
	
	
});